/*
 * Copyright (C) 2010-2011 Enrique Lara (enrique.posix2.lara@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
 * limitations under the License.
  */
package trs.wmata.api;

import app.timetogo.model.Agency;
import static trs.wmata.api.Util.getLname;

import org.xml.sax.helpers.DefaultHandler;

public class BusStops extends DefaultHandler {
    public static final String LAT = "Lat";
    public static final String LON = "Lon";
    public static final String NAME = "Name";
    public static final String ROUTES = "Routes";
    public static final String STOP = "Stop";
    public static final String STOPID = "StopID";
    public static final String STOPS = "Stops";
    public static final String STOPSRESP = "StopsResp";
    public static final String A_STRING = "a:string";
    private final StringBuilder buff = new StringBuilder();
    private final Agency agency;

    public BusStops(final Agency agency) {
        this.agency = agency;
    }

    public void startElement(final String uri, final String name, final String qName) {
        String lName = getLname(name, qName);

        if (LAT.equals(lName)) {
            //current_element_id = LAT_ID;
        } else if (LON.equals(lName)) {
            //current_element_id = LON_ID;
        } else if (NAME.equals(lName)) {
            //current_element_id = NAME_ID;
        } else if (ROUTES.equals(lName)) {
            //current_element_id = ROUTES_ID;
        } else if (STOP.equals(lName)) {
            //current_element_id = STOP_ID;
        } else if (STOPID.equals(lName)) {
            //current_element_id = STOPID_ID;
        } else if (STOPS.equals(lName)) {
            //current_element_id = STOPS_ID;
        } else if (STOPSRESP.equals(lName)) {
            //current_element_id = STOPSRESP_ID;
        } else if (A_STRING.equals(lName)) {
            //current_element_id = A:STRING_ID;
        }

        buff.delete(0, buff.length());
    }

    public void endElement(final String uri, final String name, final String qName) {
        String lName = getLname(name, qName);

        if (LAT.equals(lName)) {
            //current_element_id = LAT_ID;
        } else if (LON.equals(lName)) {
            //current_element_id = LON_ID;
        } else if (NAME.equals(lName)) {
            //current_element_id = NAME_ID;
        } else if (ROUTES.equals(lName)) {
            //current_element_id = ROUTES_ID;
        } else if (STOP.equals(lName)) {
            //current_element_id = STOP_ID;
        } else if (STOPID.equals(lName)) {
            //current_element_id = STOPID_ID;
        } else if (STOPS.equals(lName)) {
            //current_element_id = STOPS_ID;
        } else if (STOPSRESP.equals(lName)) {
            //current_element_id = STOPSRESP_ID;
        } else if (A_STRING.equals(lName)) {
            //current_element_id = A:STRING_ID;
        }
    }

    @Override
    public void characters(final char[] ch, final int start, final int length) {
        buff.append(ch, start, length); //XXX
    }
}
